Methods and apparatuses for two-qubit gate reduction in quantum circuits

ABSTRACT

The disclosure describes a method, an apparatus, a computer-readable medium, and/or means for reducing two-qubit gates in quantum circuits may include receiving a netlist including information relating to a first plurality of two-qubit quantum gates that form the quantum circuits, performing a controlled gate cancellation operation on the information relating to a first plurality of two-qubit quantum gates to produce a second plurality of two-qubit quantum gates that is functionally equivalent to the first plurality of two-qubit quantum gates, wherein a first number of two-qubit quantum gates in the first plurality of two-qubit quantum gates is larger than a second number of two-qubit quantum gates in the second plurality of two-qubit quantum gates, generating a new netlist containing information about the second plurality of two-qubit quantum gates, and providing the new netlist to implement a functionality of the quantum circuits based on the second plurality of two-qubit quantum gates.

CROSS REFERENCE TO RELATED APPLICATIONS

The present application claims priority to and the benefit from U.S. Provisional Patent Application No. 62/776,634, entitled “METHODS AND APPARATUSES FOR TWO-QUBIT GATE REDUCTION IN QUANTUM CIRCUITS,” and filed Dec. 7, 2018, the contents of which are incorporated herein by reference in their entirety.

BACKGROUND OF THE DISCLOSURE

Aspects of the present disclosure generally relate to circuit optimization, and more specifically, to an automated optimization of large-scale quantum circuits with continuous parameters.

Large-scale quantum circuits may be implemented in different ways. The use of trapped atomic ions is one of the quantum information processing (QIP) approaches that has delivered universal and fully programmable quantum computing machines. Trapped atomic ions are also a leading platform for quantum information networks (QINs). Systems or networks based on trapped atomic ions that can improve the overall communications of such systems or networks are desirable.

It is therefore desirable to develop efficient techniques that allow for better optimization (e.g., smaller number of gates) of large-scale quantum circuits in various types of QIP systems, including QIP systems that are based on trapped atomic ions as well as those that are based on, for example, superconducting circuits.

SUMMARY OF THE DISCLOSURE

The following presents a simplified summary of one or more aspects in order to provide a basic understanding of such aspects. This summary is not an extensive overview of all contemplated aspects, and is intended to neither identify key or critical elements of all aspects nor delineate the scope of any or all aspects. Its purpose is to present some concepts of one or more aspects in a simplified form as a prelude to the more detailed description that is presented later.

Described herein are techniques for automated optimization of large-scale quantum circuits with continuous parameters. For example, aspects of this disclosure describe the implementation of automated methods for optimizing quantum circuits of the size and type expected in quantum computations that outperform classical computers. The techniques described herein illustrate how to handle continuous gate parameters and can be applied to a collection of fast algorithms capable of optimizing large-scale quantum circuits. These techniques can provide better optimization in significantly less time than previous approaches, while making minimal structural changes so as to preserve the basic layout of the underlying quantum algorithms. The results provided by these techniques help bridge the gap between computations that can be run on existing quantum computing hardware and more advanced computations that are more challenging to implement in quantum computing hardware but are the ones that are expected to outperform what can be achieved with classical computers.

In an example, a method for optimizing quantum circuits is described that includes receiving a netlist containing information about a first list of quantum gates that form the quantum circuits, performing a phase-polynomial reduction operation on the information about the first list of quantum gates to produce a second list of quantum gates that has functional equivalence to the first list of quantum gates, a computational cost, such as a number of quantum gates, in the second list of quantum gates being smaller than a computational cost, such as a number of quantum gates, in the first list of quantum gates, generating a new netlist containing information about the second list of quantum gates, and providing the new netlist to implement a functionality of the quantum circuits using the second list of quantum gates.

In some implementations, a method for reducing two-qubit gates in quantum circuits may include receiving a netlist including information relating to a first plurality of two-qubit quantum gates that form the quantum circuits, performing a controlled gate cancellation operation on the information relating to a first plurality of two-qubit quantum gates to produce a second plurality of two-qubit quantum gates that is functionally equivalent to the first plurality of two-qubit quantum gates, wherein a first number of two-qubit quantum gates in the first plurality of two-qubit quantum gates is larger than a second number of two-qubit quantum gates in the second plurality of two-qubit quantum gates, generating a new netlist containing information about the second plurality of two-qubit quantum gates, and providing the new netlist to implement a functionality of the quantum circuits based on the second plurality of two-qubit quantum gates.

BRIEF DESCRIPTION OF THE DRAWINGS

The appended drawings illustrate only some implementation and are therefore not to be considered limiting of scope.

FIG. 1 is a diagram that illustrates an example of a quantum circuit in accordance with aspects of this disclosure.

FIG. 2 is a diagram that illustrates an example of a quantum circuit for phase polynomial representation in accordance with aspects of this disclosure.

FIG. 3 is a diagram that illustrates examples of rules for Hadamard gate reduction in accordance with aspects of this disclosure.

FIG. 4 is a diagram that illustrates examples of commutation rules in accordance with aspects of this disclosure.

FIG. 5 is a diagram that illustrates an example of an optimization subroutine with rotation merging using phase polynomials in accordance with aspects of this disclosure.

FIG. 6 is a diagram that illustrates a subcircuit amenable to phase polynomial representation in accordance with aspects of this disclosure.

FIG. 7 is a diagram that illustrates examples of gate count preserving rewriting rules in accordance with aspects of this disclosure.

FIG. 8 is a diagram that illustrates examples of gate count reducing rewriting rules in accordance with aspects of this disclosure.

FIG. 9 is a diagram that illustrates an example of further simplification of the circuit in FIG. 5 in accordance with aspects of this disclosure.

FIG. 10 is a diagram that illustrates examples of Toffoli gate implementations in accordance with aspects of this disclosure.

FIG. 11 is a chart that illustrates examples of total gate counts for the approximate quantum Fourier transform (QFT), Quipper library adder, and Fourier-based adders (QFA) in accordance with aspects of this disclosure.

FIG. 12 is a chart that illustrates examples of numbers of CNOT gates for Quipper library adders in accordance with aspects of this disclosure.

FIG. 13 is a table that illustrates results for light optimization of adder circuits in accordance with aspects of this disclosure.

FIG. 14 is a table that illustrates results for heavy optimization of Quipper library adder in accordance with aspects of this disclosure.

FIG. 15 is a chart that illustrates examples of total gate counts for product formula algorithms in accordance with aspects of this disclosure.

FIGS. 16A and 16B are tables that illustrate results for optimization of product formula algorithms in accordance with aspects of this disclosure.

FIGS. 17A-17C are tables that illustrate comparisons of T-par optimization with light and heavy optimization for different algorithms in accordance with aspects of this disclosure.

FIG. 18 is a block diagram that illustrates an example of a device for performing automated optimization of large-scale quantum circuits with continuous parameters in accordance with aspects of this disclosure.

FIG. 19 is a flow chart that illustrates an example of a method for automated optimization of large-scale quantum circuits with continuous parameters in accordance with aspects of this disclosure.

FIG. 20 is a block diagram that illustrates an example of a trapped-ion-based quantum information processing (QIP) system for implementing optimized large-scale quantum circuits in accordance with aspects of this disclosure.

FIG. 21 is a diagram that illustrates examples of rules for 2-qubit quantum gate reduction in accordance with aspects of this disclosure.

FIGS. 22A and 22B are diagrams that illustrate examples of rules for controlled gate cancellation in accordance with aspects of this disclosure.

FIG. 23 shows diagrams of equivalent quantum circuits in accordance with aspects of this disclosure.

FIG. 24 is a flow chart that illustrates an example of a method for reducing two-qubit quantum gates in quantum circuits in accordance with aspects of this disclosure.

DETAILED DESCRIPTION

The detailed description set forth below in connection with the appended drawings is intended as a description of various configurations and is not intended to represent the only configurations in which the concepts described herein may be practiced. The detailed description includes specific details for the purpose of providing a thorough understanding of various concepts. However, it will be apparent to those skilled in the art that these concepts may be practiced without these specific details. In some instances, well known components are shown in block diagram form in order to avoid obscuring such concepts.

The disclosure describes the implementation of automated techniques for optimizing quantum circuits of the size and type expected in quantum computations that outperform classical computers. The disclosure shows how to handle continuous gate parameters and report a collection of fast algorithms capable of optimizing large-scale quantum circuits. For the suite of benchmarks considered, the techniques described can obtain substantial reductions in gate counts. In particular, the techniques in this disclosure provide better optimization in significantly less time than previous approaches, while making minimal structural changes so as to preserve the basic layout of the underlying quantum algorithms. The results provided by these techniques help bridge the gap between computations that can be run on existing quantum computing hardware and more advanced computations that are more challenging to implement in quantum computing hardware but are the ones that are expected to outperform what can be achieved with classical computers.

Introduction

Quantum computers or quantum information processing (QIP) systems have the potential to dramatically outperform classical computers at solving certain problems. Perhaps their best-known application is to the task of factoring integers: whereas the fastest known classical algorithm is superpolynomial, Shor's algorithm solves this problem in polynomial time, providing an attack on the widely-used RSA cryptosystem.

Even before the discovery of Shor's algorithm, quantum computers were proposed for simulating quantum mechanics. By simulating Hamiltonian dynamics, quantum computers can study phenomena in condensed matter and high-energy physics, quantum chemistry, and materials science. Useful instances of quantum simulation are likely accessible to smaller-scale quantum computers than classically-hard instances of the factoring problem.

These and other potential applications have helped motivate significant efforts toward building a scalable quantum computer. Two quantum computing technologies, superconducting circuits and trapped ions, have matured sufficiently to enable fully programmable universal devices, albeit currently of modest size. Several groups are actively developing these platforms into larger-scale devices, backed by significant investments from both industry and government. Thus, quantum computations involving tens or even hundreds of qubits are likely to be carried out in the not-too-distant future.

Experimental quantum information processing remains a difficult technical challenge, and the resources available for quantum computation will likely continue to be expensive and severely limited for some time. To make the most out of the available hardware, it is essential to develop implementations of quantum algorithms that are as efficient as possible (e.g., implemented with the fewest number of gates).

Quantum algorithms are typically expressed in terms of quantum circuits, which describe a computation as a sequence of elementary quantum logic gates acting on qubits. There are many ways of implementing a given algorithm with an available set of elementary operations, and it is advantageous to find an implementation that uses the fewest resources. While it is important to develop algorithms that are efficient in an abstract sense and to implement them with an eye toward practical efficiency, large-scale quantum circuits are likely to have sufficient complexity to benefit from techniques that enable automated optimization.

In this disclosure, various techniques are described that can be implemented as software tools (e.g., quantum circuit optimizer) for reducing the size of quantum circuits, aiming to improve their performance as much as possible at a scale where manual gate-level optimization is no longer practical. Since global optimization of arbitrary quantum circuits is QMA-hard, the approach described in this disclosure is to apply a set of carefully chosen heuristics in an automated fashion to reduce the gate counts, often resulting in substantial savings.

The optimization techniques described herein can be applied to several types of quantum circuits. Benchmark circuits include components of quantum algorithms for factoring and computing discrete logarithms, such as the quantum Fourier transform, integer adders, and Galois field multipliers. Also considered are circuits for the product formula approach to Hamiltonian simulation. In each of these cases, the focus is on circuit sizes that are likely to be useful in applications that outperform classical computation. The techniques described herein can help practitioners understand which implementation of an algorithm is most efficient in a given application.

While there is existing work on quantum circuit optimization, there is limited work that focuses on automated optimization techniques targeting large-scale circuits such as the ones considered here. Moreover, as described in more detail below, extrapolation of previously-reported runtimes suggests it is unlikely that existing quantum circuit optimizers would perform well for such large circuits. Direct comparisons between circuits optimized using the proposed techniques of this disclosure and other approaches show that the proposed techniques typically finds smaller circuits in less time. In addition, the proposed techniques of this disclosure are used for automated optimization of quantum circuits with continuous gate parameters.

General Discussion

In this disclosure, the problem of efficiently optimizing large-scale quantum circuits is considered, namely those quantum circuits appearing in quantum computations that are beyond the reach of classical computers. The disclosure describes two optimization approaches referred to as Light and Heavy optimization algorithms (e.g., Light version and Heavy version of the optimizer) that can be implemented and performed as software solutions (e.g., offline solutions to large-scale quantum circuit optimization). These algorithms are based on a chosen sequence of basic optimizations, yet they achieve substantial reductions in the gate counts, improving over more mathematically sophisticated approaches such as T-par optimization (described in more detail below). The simplicity of our approach is reflected in very fast runtimes, especially using the Light version of the optimizer.

The Heavy version of the optimizer demonstrates that even greater circuit optimization is possible. To further improve the output, it is possible to modify the routines for reducing R_(z) count by implementing more extensive (and thus more computationally demanding) algorithms for composing stages of CNOT and R_(z) gates, possibly with some Hadamard gates included. Another consideration is to incorporate template-based and peep-hole optimizations into the algorithms described herein. Another consideration is to expand the set of subcircuit rewriting rules (described in more detail below) and consider the performance of the approach on other benchmark circuits. Finally, considering the relative cost of different resources (e.g., different types of gates, ancilla qubits) could lead to optimizers that favorably trade off these resources.

Methods

Details regarding various optimization algorithms proposed in this disclosure and their implementation are described below. Throughout this disclosure the term g is used to denote the number of gates appearing in a circuit. The Background section below provides definition of notations used throughout this disclosure. The section titled Representations of quantum circuits describes three distinct representations of quantum circuits that can be employed in connection with the techniques described herein. In section titled Pre-processing, a pre-processing step is described that can be used with the various optimization algorithms described herein. In section titled Optimization subroutines, several subroutines are described that form the basic building blocks of the approach proposed in this disclosure. Moreover, the section titled General-purpose optimization algorithms explains how these subroutines are combined to form various versions of the optimization algorithms. Finally, in the section titled Special-purpose optimizations, two special-purpose optimization techniques are presented that can be used to handle particular types of circuits.

Background

A quantum circuit is a sequence of quantum gates acting on a collection of qubits. Quantum circuits are conveniently represented by diagrams in which horizontal wires denote time evolution of qubits, with time propagating from left to right, and boxes (or other symbols joining the wires) represent quantum gates. For example, the diagram 100 in FIG. 1 describes a simple three-qubit quantum circuit. The circuit in the diagram 100 includes two (2) single-qubit z-rotation gates (110 a, 110 b), R_(z)(θ) and R_(z)(θ′), two (2) single-qubit Hadamard gates (120 a, 120 b), H, and four (4) two-qubit controlled-NOT gates (130 a, 130 b, 130 c, and 130 d), CNOTs.

A simple set of elementary gates is considered for quantum circuits consisting of the two-qubit CNOT gates, together with single-qubit NOT gate, single-qubit Hadamard gates, and single-qubit z-rotation gates as shown in the circuit in the diagram 100. Unitary matrices for these types of gates take expressions of the form:

$\begin{matrix} {{{NOT}\mspace{14mu} \text{:=}\mspace{14mu} \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}},{H\mspace{14mu} \text{:=}\mspace{14mu} \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & {- 1} \end{pmatrix}},{{R_{z}(\theta)}\mspace{14mu} \text{:=}\mspace{14mu} \begin{pmatrix} e^{{- i}\; \theta \text{/}2} & 0 \\ 0 & e^{i\; \theta \text{/}2} \end{pmatrix}},{{and}\mspace{14mu} {CNOT}\mspace{14mu} \text{:=}\mspace{14mu} \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}},} & (1) \end{matrix}$

where θ ∈ (0, 2π] is the rotation angle. The phase gate P and the T gate can be obtained from R_(z)(θ) up to an undetectable global phase as R_(z)(π/2) and R_(z)(π/4), respectively. When the rotation angle is irrelevant, it is possible to denote a generic z-rotation by R_(z).

Although the techniques described herein tend to produce quantum circuits over the set of H, R_(z), NOT, and CNOT gates, input circuits that may include Toffoli gates can also be considered. The Toffoli gate (e.g., gate 1010 a in a diagram 1000 in FIG. 10) is described by the mapping |x, y, z

|x, y, z ⊕(x ∧y)

of the computational basis states. The Toffoli gates are also allowed to have negated controls. For example, the Toffoli gate with its top control negated (e.g., gate 1010 b in the diagram 1000 in FIG. 10) acts as |x,y,z

|x, y, z ⊕(x ∧y)

; and the Toffoli gate with both controls negated (e.g., gate 1010 c in the diagram 1000 in FIG. 10) acts as |x, y, z

|x, y, z ⊕(x ∧y).

The cost of performing a given quantum circuit depends on the physical system used to implement it. For example, there may be different cost considerations if the physical system is based on superconducting circuits or trapped atomic ions. The cost can also vary significantly between a physical-level (unprotected) implementation and a logical-level (fault-tolerant) implementation. At the physical level, a two-qubit gate is typically more expensive to implement than a single-qubit gate. The techniques described herein accommodate for this by considering the CNOT gate count and optimizing the number of the CNOT gates in the optimization algorithms.

For logical-level fault-tolerant circuits, the so-called Clifford operations (generated by the Hadamard, Phase, and CNOT gates) are often relatively easy to implement, whereas non-Clifford operations can incur significant overhead. Thus the number of R_(z) gates are also considered in the optimization algorithms, which try to optimize their count. In fault-tolerant implementations, R_(z) gates are approximated over a discrete gate set, typically consisting of Clifford and T gates. Optimal algorithms for producing such approximations are known. The number of Clifford+T gates required to approximate a generic R_(z) gate depends primarily on the desired accuracy rather than the specific angle of rotation, so it is preferable to optimize a circuit before approximating its R_(z) gates with Clifford+T fault-tolerant circuits.

By minimizing both the CNOT and R_(z) counts, it is possible to perform optimizations targeting both physical- and logical-level implementations. Trade-offs between these two goals may be expected, and there are instances where such trade-offs do occur. However, in the techniques described herein only optimizations aimed at reducing both the R_(z) and CNOT counts are considered.

Representations of Quantum Circuits

The following three representations of quantum circuits can be used in connection with the optimization techniques or optimization algorithms described herein:

First, a circuit can be stored as a list of gates to be applied sequentially (a netlist). It is sometimes convenient to specify the circuit in terms of subroutines (e.g., circuit subroutines), which can be referred to as blocks. Each block can be iterated any number of times and applied to any subset of the qubits present in the circuit. A representation using blocks can be especially concise since many quantum circuits exhibit a significant amount of repetition. A block is specified as a list of gates and qubit addresses.

The netlist representation can be input and output using a format produced by Quipper, a quantum programming language that is used to specify some of benchmark circuits. This format includes the ability to handle blocks. Other quantum programming languages and/or formats that have the same ability may also be used.

Second, a directed acyclic graph (DAG) representation can be used. The vertices of the DAG are the gates of the circuit and the edges encode their input/output relationships. The DAG representation has the advantage of making adjacency between gates easy to access.

Third, a generalization of the phase polynomial representation of {NOT, CNOT, T} circuits can also be used. Unlike the netlist and DAG representations, this last representation applies only to circuits consisting entirely of NOT, CNOT, and R_(z) gates. Such circuits can be concisely expressed as the composition of a linear Boolean transformation and a diagonal phase transformation. For example, let C be a circuit consisting only of CNOT gates and the gates R_(z)(θ₁), R_(z)(θ₂), . . . , R_(z)(θ₁). Then the action of C on the n-qubit basis state |x₁, x₂ . . . , x_(n)) has an expression of the form

|x ₁ x ₂ , . . . ,x _(n)

e ^(ip(x) ¹ ^(,x) ² ^(, . . . ,x) ^(n) ⁾ |h(x ₁ x ₂ , . . . ,x _(n))

  (2)

where h: {0,1}^(n)→{0,1}^(n) is a linear reversible function and

p(x ₁ ,x ₂ , . . . ,x _(n))=Σ_(i=1) ^(l)(θ_(i) mod 2π)·f _(i)(x ₁ ,x ₂ , . . . ,x _(n))  (3)

is a linear combination of affine Boolean functions f_(i): {0,1}^(n)→{0,1} with the coefficients reduced modulo 2π. The term p(x₁, x₂ . . . , x_(n)) is referred to as the phase polynomial associated with the circuit C. For example, the circuit shown in a diagram 200 in FIG. 2 having four (4) single-qubit z-rotation gates (210 a, 210 b, 210 c, and 210 d) and three (3) two-qubit CNOT gates (230 a, 230 b, and 230 c), can be represented by the mapping expression:

|x,y

e ^(ip(x,Y)) |x⊕y,y),  (4)

where p(x,y)=θ₁y+θ₂(x⊕y)+θ₃x+θ₄y. In some instances, the phase polynomial representation may only be considered for {CNOT, T} circuits, so all θ_(i) in the expression (3) are integer multiples of α/4 and the functions f_(i) are linear.

It is possible to convert between any two of the above three circuit representations in time linear in the number of gates in the circuit. Given a netlist, it is possible to build the corresponding DAG gate-by-gate. Conversely, it is possible to convert a DAG to a netlist by standard topological sorting. Conversion between the netlist and phase polynomial representations of {NOT, CNOT, R_(z)} circuits is possible by using, for example, a straightforward generalization described in connection with, for example, a meet-in-the middle algorithm used for fast synthesis of depth-optimal quantum circuits.

Pre-Processing

Before running the main optimization procedures (e.g., optimization algorithms), the circuit may be preprocessed to make it more amenable to further optimization. Since the optimizer can take, in addition to NOT, CNOT, and Toffoli gates, H and R_(z)(θ) gates, then the pre-processing can be applied to an input circuit consisting of NOT, CNOT, Toffoli, H, and/or R_(z)(θ) gates. Some examples are the Quipper adders and the T-par circuit benchmarks described in more detail below. For instance, the NOT gates can be pushed as far to the right as possible by commuting them through the controls of Toffoli gates and the targets of Toffoli and CNOT gates. When pushing a NOT gate through a Toffoli gate control, that control is negated (or the negation is removed if it was initially negated). If this procedure leads to a pair of adjacent NOT gates, the NOT gates can be removed from the circuit. If no such cancellation is found, the control negation changes may be reverted and the NOT gate may be moved back to its original position. Moreover, the commutation relation between the NOT gate and the H gate is such that NOT followed by H is H followed by a Z gate, where a Z gate is R_(z)(θ=π). Also, NOT followed by R_(z)(θ) is R_(z)(−θ) followed by NOT. Therefore, for the standard set of gates that consists of NOT, CNOT, Toffoli, H, and R_(z) gates, together with the details described below in connection with reducing all affine functions of phases to linear functions by using NOT propagation through CNOT and R_(z) gates, the NOT gates can be moved to the beginning or the end of a given circuit as part of the pre-processing step.

This NOT gate propagation leverages two aspects of the proposed optimizer or optimization algorithms. First, it is possible to accept Toffoli gates that may have negated controls and optimize their decomposition into Clifford+T circuits by exploiting freedom in the choice of T/T^(†) polarities, as described in more detail below. Second, since cancelations of NOT gates simplify the phase polynomial representation (by making some of the functions f_(i) in the phase polynomial representation (expression 3) linear instead of merely affine), such cancelations make it more likely that Subroutines 4 and 5 described below will find optimizations (since those subroutines rely on finding matching terms in the phase polynomial representation).

The complexity of this pre-processing step is O(g) since it is simply making a single pass through the circuit.

Optimization Subroutines

The optimization algorithms of this disclosure rely on a variety of subroutines that are described below in more detail. For each of them, the worst-case time complexity as a function of the number of gates g in the circuit is reported (for simplicity, the dependence on the number of qubits and other parameters is neglected). However, practical-case software runtime can be optimized by carefully ordering and restricting the subroutines, as discussed further below.

Subroutine 1—Hadamard Gate Reduction

Hadamard gates do not participate in phase polynomial optimization (Subroutines 4 and 5 below) and also tend to hinder gate commutation. Thus, the circuit identities or rules pictured in a diagram 300 in FIG. 3 are used to reduce the Hadamard gate count. The identities or rules include rules 310 a and 310 b at the bottom of the diagram 300 and rules 320 a, 320 b, and 320 c at the top of the diagram 300. The rules 310 a and 310 b can be applied even if the middle CNOT gate is replaced by a circuit with arbitrarily many CNOT gates, provided that all of them share the target of the original CNOT gate.

Each application of these rules reduces the H count by up to 4. For a given Hadamard gate, the DAG representation can be used to check in constant time whether it is involved in one of these circuit identities. Thus, it is possible to implement this subroutine with complexity O(g) by making a single pass through all Hadamard gates in the circuit.

Subroutine 2—Single-Qubit Gate Cancelation

Using the DAG representation of a quantum circuit, it is generally straightforward to determine whether a gate and its inverse are adjacent. If so, both gates can be removed to reduce the gate count. More generally, it is possible to cancel two single-qubit gates U and U^(†) that are separated by a subcircuit A that commutes with U. In general, deciding whether a gate U commutes with a circuit A may be computationally demanding. Instead, it is possible to apply a specific set of rules that provide sufficient (but not necessary) conditions for commutation. This approach is fast and appears to discover many commutations that can be exploited to simplify quantum circuits.

Specifically, for each gate U in the circuit, the optimizer or optimization algorithms search for possible cancelations with some instance of U^(†). To do this, the approach is to repeatedly check whether U commutes through a set of consecutive gates, as evidenced by one of the patterns in a diagram 400 in FIG. 4. The diagram 400 includes commutation rules such as rules 410 a, 410 b, and 410 c at the top for commuting an R_(z) gate to the right, and rules 420 a, 420 b, and 420 c for commuting a CNOT gate to the right. If at some stage it is not possible to move U to the right by some allowed commutation pattern, then cancelation of U with a matched U^(†) fails, and the initial configuration is restored. Otherwise, cancelation of U with some instance of U^(†) is successful. The commutation scheme described above need not be applied only with the specific direction to the right but may also be applied with the specific direction to the left.

For each of the g gates U, the subroutine checks whether it commutes through O(g) subsequent positions. Thus the complexity of the overall gate cancelation rule is O(g²). The complexity could be made linear in g by only considering commutations through a constant number of subsequent gates, but this is not found to be necessary in practice.

A slight variation of this subroutine can be used to merge rotation gates, rather than cancel inverses. Specifically, two rotations R_(z)(θ₁) and R_(z)(θ₂) can be combined into a single rotation R_(z)(θ₁+θ₂) to eliminate one R_(z) gate.

Subroutine 3. Two-Qubit Gate Cancelation

This subroutine is analogous to subroutine 2, except that U is a two-qubit gate, which is generally CNOT in the circuits under consideration. Again, the complexity of this subroutine is O(g²), but may be reduced to O(g) by imposing a maximal size for the subcircuit A.

Subroutine 4. Rotation Merging Using Phase Polynomials

In this case, a subcircuit consisting of the NOT, CNOT, and R_(z) gates is considered. If two individual terms of its phase polynomial expression satisfy the expression

f _(i)(x ₁ ,x ₂ . . . x _(n))=f _(j)(x ₁ ,x ₂ , . . . , x _(n))  (5)

for some i≠j, then the corresponding rotations R_(z)(θ_(i)) and R_(z)(θ_(j)) can be merged. For example, in the circuit shown in the diagram 200 in FIG. 2, the first and fourth rotations are both applied to the qubit carrying the value y, as evidenced by its phase polynomial representation. Thus the circuit in the diagram 200 in FIG. 2 goes through the transformation shown in a diagram 500 in FIG. 5 in which the two rotations are combined. The transformed circuit to the right in the diagram 500 includes R_(z) gates 510 a, 510 b, and 510 c, where R_(z) gate 510 c has the two rotations combined, as well as CNOT gates 530 a, 530 b, and 530 c.

In other words, the phase polynomial representation of circuits reveals when two rotations—in this case, R_(z)(θ₁) and R_(z)(θ₄)—are applied to the same affine function of the inputs, even if they appear in different parts of the circuit. Then these rotations can be combined into a single rotation, improving the circuit. In this particular example, the simplification could have alternatively been obtained using the commutation techniques described above; however, that may not generally be the case. There is a flexibility to place the combined rotation at any point in the circuit where the relevant affine function appears. For concreteness, the combined rotation is placed at the first (leftmost) such location.

To apply Subroutine 4, a subcircuit consisting only of {NOT, CNOT, R_(z)} gates needs to be identified. This subcircuit is built one qubit at a time, starting from a designated CNOT gate. For the first qubit of this gate, the DAG representation is used to scan through all preceding and subsequent NOT, CNOT, and R_(z) gates that act on this qubit, adding them to the subcircuit. When a Hadamard gate is encountered at the beginning or end of the circuit, a termination point is marked and exploring in that direction is stopped (so that each qubit has one beginning termination point and one ending termination point). For each CNOT gate between this qubit and some qubit that has not yet been encountered, an anchor point is marked where the gate acts on the newly-encountered qubit. This process is carried out with the second qubit acted on by the initial CNOT gate, and the process is repeated starting from every anchor point until no new qubits are encountered.

While the resulting subcircuit consists only of NOT, CNOT, and R_(z) gates, it may not have a polynomial phase representation—specifically, intermediate Hadamard gates on the wires that leave and re-enter the subcircuit can prevent this. To apply the phase polynomial formalism, it is necessary that this does not happen using the following pruning procedure. Starting with the designated initial CNOT gate, gates both before and after it in the netlist are successively considered until a termination point is encountered. Note that only CNOT gates need to be considered since every NOT and R_(z) gate reached by this process can be included, as it does not prevent the phase polynomial expression from being applied. If both the control and target qubits of an encountered CNOT gate are within the termination border, then the procedure can continue. If the control qubit is outside the termination border but the target qubit is inside, the termination point of the target qubit is moved so that the CNOT gate being inspected falls outside the border, excluding it and any subsequent gates acting on its target qubit from the subcircuit. However, when the control is inside the border and the target is outside, an exception is made and the termination point is not moved (although the CNOT gate is not included in the subcircuit). This exception gives a larger {NOT, CNOT, R_(z)} subcircuit that remains amenable to phase polynomial representation, as illustrated in the example in a diagram 600 in FIG. 6.

In the example specified by the circuit in the diagram 600, it is possible to start the search from the first CNOT gate acting on the top (q₁) and middle (q₂) qubits (e.g., CNOT gate 630 a). Traversing q₁ to the left, an H gate is found (e.g., H gate 620 a), where a termination point is marked. Traversing q₁ to the right, two CNOT gates are found (e.g., CNOT gates 630 b, 630 c), one R_(z) gate is found (e.g., R_(z) gate 610 a), and then an H gate is found (e.g., H gate 620 b), where a termination point is marked. Neither of the encountered CNOT gates joins q₁ or q₂ to the remaining qubit q₃. The same procedure is repeated on q₂ from the original CNOT gate (e.g., CNOT gate 630 a). To the left an R_(z) gate is found (e.g., R_(z) gate 610 b) and then an H gate (e.g., H gate 620 c), where a termination point is marked. Traversing to the right, a CNOT gate is found acting on q₂ and q₃ (e.g., CNOT gate 630 d). This CNOT reveals additional connectivity, so an anchor point is marked on q₃ on the q₃ (target) side of this CNOT gate. Further to the right on the q₂ wire, there are three more CNOT gates (e.g., CNOT gates 630 b, 630 e, and 630 c), none of which reveals additional connectivity, an R_(z) gate (e.g., R_(z) gate 610 c), and finally an H gate (e.g., H gate 620 d), where a termination point is marked. Next q₃ is examined by starting from the aforementioned anchor point. To the left, an H gate (e.g., H gate 620 e) is found with no further connections to other qubits, and a termination point is marked. To the right, an H gate (e.g., H gate 620 f) is immediately found and a termination point is marked.

Having built the subcircuit, next is to go through the netlist representation and to prune it. In this pass, the fourth CNOT gate acting on q₂ and q₃ is encountered (e.g., CNOT gate 630 e), where the control is within the border of the subcircuit but the target is not. In this case the exception handling scheme described in the pruning procedure is applied. This ensures that the last CNOT gate in the {NOT, CNOT, R_(z)} region is included, while excluding the fourth CNOT gate (as indicated by the dashed border in the diagram 600). Thus the last R_(z) gate appearing in the circuit can be relocated to the very beginning of the circuit on the q₂ line, to the right of the leftmost H, enabling a phase-polynomial based R_(z) merge, as described in more detail below.

Once a valid {NOT, CNOT, R_(z)} subcircuit is identified, its phase polynomial can be generated. For each R_(z) gate, it is possible to determine the associated affine function its phase is applied to and the location in the circuit where it is applied. The list of recorded affine functions is then sorted. Finally, it is possible to find and merge all R_(z) gate repetitions, placing the merged R_(z) at the first location in the subcircuit that computes the desired linear function.

This procedure considers O(g) subcircuits, and the cost of processing each of these is dominated by sorting, with complexity O(g log g), giving an overall complexity of O(g² log g) for Subroutine 4. However, in practice the subcircuits are typically smaller when there are more of them to consider, so the true complexity is lower. In addition, when identifying a {NOT, CNOT, R_(z)} subcircuit, the process typically starts with a CNOT gate that has not yet been included in any of the previously-identified {NOT, CNOT, R_(z)} subcircuits, so the number of subcircuits can be much smaller than g in practice. If desired, the overall complexity can be lowered to O(g) by limiting the maximal size of the subcircuit.

As a final step, it is possible to reduce all affine functions of phases to linear functions. This can be accomplished using NOT propagation through CNOT and R_(z) gates as follows:

-   -   NOT(a)CNOT(a; b)         CNOT(a; b)NOT(a)NOT(b);     -   NOT(b)CNOT(a; b)         CNOT(a; b)NOT(b);     -   NOT(a)R_(z)(a)         R_(z) ^(†)(a)NOT(a)

Applying this procedure ensures that each affine function x_(i) ₁ ⊕x_(i) ₂ ⊕ . . . ⊕x_(i) _(k) ⊕1transforms into the corresponding linear function x_(i) ₁ ⊕x_(i) ₂ ⊕ . . . ⊕x_(i) _(k) , thereby improving the chance to induce further phase collisions.

Subroutine 5—Floating R_(z) Gates

In Subroutine 4, the affine functions associated with R_(z) gates are tracked. More generally, all affine functions that occur in the subcircuit and their respective locations are recorded, regardless of the presence of R_(z) gates. Thus it is possible to identify all possible locations where an R_(z) gate could be placed, not just those locations where R_(z) gates already appear in the circuit. In this “floating” R_(z) gate placement picture, three optimization sub-subroutines can be employed: two-qubit gate cancelations, gate count preserving rewriting rules, and gate count reducing rewriting rules.

The first of these sub-subroutines is essentially identical to Subroutine 4, except that R_(z) gates are now floatable and the focus is on a specific identified subcircuit. This approach allows to place the R_(z) gates so as to facilitate cancelations by keeping track of all possible R_(z) gate locations along the way. In particular, if not placing an R_(z) gate at a particular location will allow two CNOT gates to cancel, that location is simply removed from the list of possible locations for the R_(z) gate and the CNOT cancelation is performed instead.

Next rewriting rules are applied that preserve the gate count (see e.g., a diagram 700 in FIG. 7) in an attempt to find further optimizations. For example, the diagram 700 includes gate count preserving rules 710 a and 710 b. While these replacements do not eliminate gates, they modify the circuit in ways that can enable optimizations elsewhere. The rewriting rules are provided by an external library file, and subcircuits are identified to which they can be applied using the DAG representation. The replacements are applied only if they lead to a reduction in the two-qubit gate count through one more round of the aforementioned two-qubit cancelation subroutine with floatable R_(z) gates. Note that the rewriting rules may be applicable only with certain floating R_(z) gates at particular locations in a circuit. This subroutine uses floating R_(z) gates to choose those combinations of R_(z) gate locations that lead to reduction in the gate count.

The last sub-subroutine applies rewriting rules that reduce the gate count (see e.g., a diagram 800 in FIG. 8 for gate count reducing rewriting rules employed in Subroutine 5). The diagram 800 includes gate count reducing rewriting rules 810 a, 810 b, 810 c, 810 d, and 810 e. These rules can also be provided via an external library file. Since these rules reduce the gate count on their own, the rewriting is generally performed whenever a suitable pattern is found. The complexity of this three-step subroutine (i.e., the three optimization sub-subroutines in Subroutine 5) is upper bounded by O(g³) since the number of subcircuits is O(g), and within each subcircuit, the two-qubit cancelation (Subroutine 3) has complexity O(g²). The rewriting rules (e.g., the gate count preserving rewriting rules in FIG. 7, the gate count reducing rewriting rules in FIG. 8) can be applied with complexity O(g) since, as in Subroutine 1, a single pass through the gates in the circuit suffices. Again, in practice, the number of subcircuits and the subcircuit sizes are typically inversely related, which lowers the observed complexity by about a factor of g. The complexity can be lowered to O(g²) by limiting the maximal size of the subcircuit. Indeed, the complexity can be further lowered to O(g log g) by limiting the maximal size of the subcircuit A in the two-qubit gate cancelation (the sorting could still have complexity O(g log g)).

To illustrate an example of how this optimization works, consider the circuit on the right-hand side in the diagram 500 in FIG. 5. Observe that R_(z)(θ₂) (e.g., gate 510 a) may be executed on the top qubit at the end of the circuit, allowing the first two CNOTs to cancel, leading to the optimized circuit illustrated on the right-hand side in a diagram 900 in FIG. 9, which is simplified even further by including three (3) R_(z) gates 910 a, 910 b, and 910 c, and a single CNOT gate 930 a.

General-Purpose Optimization Algorithms

The optimization algorithms or techniques described in this disclosure simply apply the various subroutines described above in a carefully chosen order. There are two versions of the optimizer or optimization algorithms that are referred to as a Light version (or simply Light) and a Heavy version (or simply Heavy). In general, the Heavy version applies more subroutines, yielding better optimization results at the cost of a higher runtime. The pre-processing step can be used in both Light and Heavy versions of the optimizer.

The Light version of the optimizer applies the optimization subroutines in the following sequence or order:

-   -   1, 3, 2, 3, 1, 2, 4, 3, 2.

This sequence is then repeated until no further optimization is achieved. This sequence is at least partially based on the principle that first exposing {CNOT, R_(z)} gates while reducing Hadamard gates (Subroutine 1) allows for a greater reduction in the cancelation routines (Subroutines 3, 2, 3), and in particular frees up two-qubit CNOT gates to facilitate single-qubit gate reductions and vice versa. Applying the replacement rule (Subroutine 1) may enable more reductions after the first four optimization subroutines. Additional single-qubit gate cancelation and merging is then sought (Subroutine 2). This enables faster identification of the {NOT, CNOT, R_(z)} subcircuit regions to look for further R_(z) count optimizations (Subroutine 4), after which the process checks for residual cancelations of the gates (Subroutines 3, 2).

The Heavy version of the optimizer applies the following sequence or order:

-   -   1, 3, 2, 3, 1, 2, 5.

Similarly, this sequence is repeated until no further optimization is achieved. The first six steps in the optimization sequence of the Heavy version of the optimizer are identical to that of the Light version of the optimizer. The difference is that in the Heavy version of the optimizer the approach used takes advantage of floating R_(z) gates (Subroutine 5), allowing locations for the R_(z) gates that admit better CNOT gate reductions to be found, including the use of gate count preserving rewriting rules to expose further gate cancelations and gate count reducing rewriting rules to remove any remaining inefficiency.

The orders or sequences described above are provided by way of illustration and other orders or sequences can also be used in which more or fewer of the subroutines described above are involved.

It is to be noted that the computational overhead incurred due to the circuit representation conversion tends to be minimal. All conversions can be done in time linear in the circuit size (see e.g., section titled Representations of quantum circuits for detail). Representations are kept consistent only as necessary. In Subroutine 1-Subroutine 3, individual gates can be accessed using the DAG representation to quickly find reductions. This allows the update of only the DAG representation to record gate count reductions before continuing with the optimization process. In Subroutine 4 and Subroutine 5, both representations can be updated concurrently on the fly whenever a reduction is found, keeping both the DAG and netlist representations consistent. This is useful since both routines identify subcircuits that are amenable to reductions using the phase polynomial representation. The identification process requires an up-to-date DAG representation and creating the phase polynomial representation requires an up-to-date netlist representation. Note that the phase polynomial representation is employed only to aid optimization in the identified subcircuit; it is not necessary to convert the phase polynomial representation back to either the netlist or the DAG representation. The phase polynomial representation may thus be safely purged when the corresponding subcircuit optimization process is finished.

Special-Purpose Optimizations

In addition to the general-purpose optimizer described above (e.g., general-purpose optimization algorithms), two specialized optimizations can be employed to improve circuits with particular structures.

optimizer: Some quantum algorithms—such as product formula simulation algorithms—involve repeating a fixed block multiple times. To optimize such a circuit, it may be best to first run the optimizer on a single block to obtain its optimized version,

. To find simplifications across multiple blocks, the circuit

² can be optimized and the result can be called

, where

the maximal prefix of

in the optimization of

². The next step is to optimize

³. Provided optimizations only occur near the boundaries between blocks, it is possible to remove the prefix

and the suffix

from the optimized version of

³, and call the remaining circuit

. Assuming that such

,

, and

can be found (which is typically the case in practice), then it is possible to simplify

^(t) to

^(t-2)

Toffoli decomposition: Many quantum algorithms are naturally described using Toffoli gates. The optimizer or optimization algorithms described in this disclosure can handle Toffoli gates with both positive and negative controls. Since the goal is to express circuits with respect to the gate set {NOT, CNOT, H, R_(z)}, the Toffoli gate is decomposed in terms of these elementary gates. The techniques described herein take advantage of different ways of doing this to improve the quality of optimization.

Specifically, the Toffoli gates can be expanded in terms of one- and two-qubit gates using the identities shown in the diagram 1000 in FIG. 10, keeping in mind that it is also possible to obtain the desired Toffoli gate by exchanging T and Tt in those circuit decompositions (because the Toffoli gate is self-inverse). As described above, the identities in the diagram 1000 include the Toffoli gate 1010 a, the Toffoli gate with top control negated 1010 b, and the Toffoli gate with both controls negated 1010 c. Initially, the optimizer leaves the polarity of T/T^(†) gates (i.e., the choice of which gates include the dagger and which do not) in each Toffoli decomposition undetermined. The optimizer symbolically processes the indeterminate T and T^(†) gates by simply moving their locations in a given quantum circuit, keeping track of their relative polarities. The optimization is considered complete when movements of the indeterminate T and T^(†) gates cannot further reduce the gate count. Finally, it is possible to choose the polarities of each Toffoli gate (subject to the fixed relationships between them) with the goal of minimizing the T count in the optimized circuit. This minimization is performed in a greedy way, choosing polarities for each Toffoli gate in the order of the appearance of the associated T/T^(†) gates in the nearly-optimized circuit, so as to reduce the T count as much as possible.

Overall, this polarity selection process takes time O(g). After selecting polarities, it is possible to run Subroutine 3 and Subroutine 2, since particular choices of polarities may lead to further cancelations of the CNOT gates and single-qubit gates that were otherwise not possible due to the presence of the indeterminate gates blocking the desired commutations.

Optimization Results

An example implementation of aspects of the optimizer or optimization algorithms described herein has been made using the Fortran programming language and tested it using three sets of benchmark circuits. All results shown in this disclosure were obtained using a machine with a 2.9 GHz Intel Core i5 processor and 8 GB of 1867 MHz DDR3 memory, running OS X El Capitan. It is to be understood that the results are provided by way of illustration and to show relative performance, and that the results may vary when performed using different hardware configurations.

As part of the testing various quantum circuits that include components of Shor's integer factoring algorithm were considered, namely the quantum Fourier transform (QFT) and the integer adders. Also considered were quantum circuits for the product formula approach to Hamiltonian simulation (PF). In both cases, the focus of the testing was on quantum circuit with sizes likely to be useful in applications that outperform classical computation, and ran experiments with different types of adders and product formulas. Finally, a set of benchmark quantum circuits were also considered, consisting of various arithmetic circuits (including a family of Galois field multipliers) and implementations of multiple control Toffoli gates. Data files describing these circuits before and after optimization are available for comparison.

Correctness of the optimizer or optimization algorithms was checked by verifying the functional equivalence (i.e., equality of the corresponding unitary matrices) of various test circuits before and after optimization. Such a test is generally feasible for circuits with a small number of qubits. These tests were performed for all 8-qubit benchmarks in Table 1 shown in a diagram 1300 in FIG. 13 and Table 2 shown in a diagram 1400 in FIG. 14. Table 1 includes light optimization of adder circuits with the results for an in-place adder based on the QFT (or QFA) on top and for a Quipper library adder at the bottom. These tests were also performed for all 10-qubit benchmarks in Tables 3A and 3B shown in diagrams 1600 a and 1600 b in FIGS. 16A and 16B, respectively. Table 3A shows optimization of product formula algorithms with CNOT gate reduction and Table 3B shows optimization of product formula algorithms with R_(z) gate reduction. Software runtimes range from 0.004 s (1st order, n=10) to 0.137 s (6th order, n=100). The Clifford gate reduction ranges from 62.5% for Hadamard and 75% for Phase gates (for the 1st order formula, independent of n) to 75% for Hadamard and 85% for Phase gates (for the 6th order formula, again independent of n). The notation “(×1000)” indicates that the gate counts for the 1st order formula are in units of thousands (no rounding errors). The notation “(L)” denotes the standard Light version of the optimization as described above.

In addition, Tables 4A-4C shown in diagrams 1700 a-1700 c in FIGS. 17A-17C represent the results of the optimizer in comparison with following benchmarks: Mod5₄, VBE-Adder₃, CSLA-MUX₃, RC-Adder₆, Mod-Red₂₁, Mod-Mult₅₅, Toff-Barenco_(3 . . . 5), Toff-NC_(3 . . . 5), GF(2⁴)-Mult, and GF(2⁵)-Mult. For example, Tables 4A-4C include T-par comparisons (described in more detail below), where the names of the benchmark algorithms are as generally known except that Toff-Barenco and Toff-NC are used to denote implementations of multiply-controlled Toffoli gates. The notation “(L)” denotes the standard Light version of the optimization, while the notation “(H)” denotes the standard Heavy version of the optimization. The symbol ┤ ├ indicates that there was no improvement in the Heavy version of the optimization over the Light version of the optimization.

QFT and Adders

The QFT is a fundamental subroutine in quantum computation, appearing in many quantum algorithms with exponential speedup. The standard circuit for the exact n-qubit QFT uses R_(z) gates, some with angles that are exponentially small in n. It is well understood that one can perform a highly-accurate approximate QFT by omitting gates with very small rotation angles. For the purposes of the optimizer or optimization algorithms of this disclosure, rotations by angles at most π/2¹³ may be omitted, which ensures sufficient accuracy of the approximate QFT for quantum circuits of the sizes under consideration. These small rotations are removed before optimization so that their omission does not contribute to the improvements reported in the results.

In the chart shown in a diagram 1100 in FIG. 11, shows the total gate count for the approximate quantum Fourier transform (QFT, inset), Quipper library adder, and Fourier-based adders (QFA). The symbols in white/black represent gate counts before/after optimization and the square/circle/triangle symbols represent gate counts for the Quipper library adder/QFA/QFT, respectively. A savings ratio of larger than 36% is observed for the QFT with 512 or more qubits. The optimization comes entirely from the reduction in the number of R_(z) gates, the most expensive resource in a fault-tolerant implementation.

As shown in the chart in the diagram 1100 in FIG. 11, two types of integer adders are considered: an in-place modulo 2^(q) adder as implemented in the Quipper library and an in-place adder based on the QFT (or QFA). The QFA circuits use an approximate QFT in which the rotations by angles less than π/2¹³ are removed, as described above. Adders are a basic component of Shor's quantum algorithm for integer factoring. The results shown report gate counts before and after optimization for the Quipper adders and the QFAs for circuits acting on 2^(L) qubits, with L ranging from 4 to 11. Adders with L=10, for example, are used in Shor's integer factoring algorithm for factoring 1,024-bit numbers. The related RSA-1024 challenge remains unsolved.

The results of Light (version) optimization of the adder circuits are shown in FIGS. 11 and 13. For the Quipper library adders, the full Light optimizer is used. For the QFA optimization, a modified Light optimizer is used instead with the sequence of subroutines 1, 3, 2, 3, 1, 2, omitting the final three subroutines 4, 3, 2 of the standard Light optimizer. This was done as no additional gate savings was found from those subroutines in small instances (n≤256).

The simplified Quipper library adder outperforms the QFA by a wide margin, suggesting that it may be preferred in practice. For the Quipper library adder, a reduction in the T gate count by a factor of up to 5.2 is observed. This reduction is obtained entirely by automated means (i.e., by the optimization algorithms), without using any prior knowledge of the circuit structure. Since Shor's integer factoring algorithm is dominated by the cost of modular exponentiation, which in turn relies primarily on integer addition, this optimization reduces the cost of executing the overall factoring algorithm by a factor of more than 5.

The Heavy optimizer was also applied to the QFT and adder circuits. For the QFT and QFA circuits, the Heavy setting does not improve the gate counts. The results of the Heavy optimization for the Quipper adder are shown in Table 2 in the diagram 1400 in FIG. 14. A reduction in the CNOT count by a factor of 2.7 is found compared to a factor of only 1.7 for the Light optimization. A chart in a diagram 1200 in FIG. 12 illustrates the total CNOT counts of the Quipper library adder before optimization (e.g., pre-optimization), after Light optimization, and after Heavy optimization, showing the reduction in the CNOT count by the two types of optimization. The square symbols in white/dot patterned/black represent the gate counts in pre-optimization/post-Light optimization/post-Heavy optimization, respectively.

Quantum Simulation

A first explicit polynomial-time quantum algorithm for simulating Hamiltonian dynamics has been introduced and the approach was later generalized to higher-order product formulas (PFs), resulting in improved asymptotic complexities. This disclosure reports gate counts before and after optimization for the PF algorithms of orders 1, 2, 4, and 6 (for orders higher than 1, the order of the standard Suzuki product-formula construction is even). For concreteness, these algorithms are implemented for a one-dimensional Heisenberg model in a magnetic field with periodic boundary conditions, evolving the system for the time proportional to its size, and the algorithm parameters are chosen to ensure the Hamiltonian simulation error is at most 10⁻³ using known bounds on the error of the product formula approximation.

The results of Light optimization of product formula algorithms are reported in Tables 3A and 3B (e.g., FIGS. 16A and 16B) and illustrated in a chart in a diagram 1500 in FIG. 15, where the symbols in white/black represent gate counts before/after optimization and the square/circle symbols represent gate counts for the second-/fourth-order formula, respectively. For these product formula algorithms, the Heavy optimization does not offer a further improvement over the Light optimization. The 2nd-, 4th-, and 6th-order algorithms admit a ˜33.3% reduction in the CNOT count and a ˜28.5% reduction in the R_(z) count, roughly corresponding to the reductions relevant to physical-level and logical-level implementations. The 1st-order formula algorithm did not exhibit CNOT or R_(z) gate optimization. In all product formula algorithms, the number of Phase and Hadamard gates reduced significantly, by a factor of roughly 3 to 6.

Comparison with Other Approaches

Quantum circuit optimization is a known field. However, prior work on circuit optimization has not considered large-scale quantum circuits of the kind that could outperform classical computers as considered in this disclosure. For instance, in the work by Amy, Maslov, and Mosca (“Polynomial-time T-depth optimization of Clifford+T circuits via matroid partitioning,” IEEE Trans. Comput. AidedDes. Integr. Circuits Syst., vol. 33, pages 1476-1489 (2014)), the complexity of optimizing a g-gate circuit is O(g³), making optimization of large-scale circuits unrealistic. There are examples of running times ranging from 0.07 to 1.883 seconds for numbers of qubits from n=10 to 35 and gate counts from 60 to 368, whereas the optimization algorithms described herein ran for a comparable time when optimizing the Quipper adders up to n=256 with around 23,000 gates, as shown in Table 1 (FIG. 13). There also are other examples of quantum circuit optimization based on peep-hole optimization using optimal gate libraries, which are expensive by taking in some cases more than 100 seconds for a 20-qubit, 1,000-gate circuit.

To compare the results produced by using the optimization algorithms proposed in this disclosure to those reported previously, a weighted combination of T and CNOT counts is considered. While the T gate can be considerably more expensive to implement fault-tolerantly using state distillation, neglecting the cost of the CNOT gates may lead to a significant underestimate. Some analysis suggest that a fault-tolerant T gate may be 46 to 350 times more expensive to implement than a local fault-tolerant CNOT gate, with at least one recommendation regarding the cost ratio being 1:50. The true overhead depends on many details, including the fault tolerance scheme, the error model, the size of the computation, architectural restrictions, the extent to which the implementation of the T gate can be optimized, and whether T state production happens offline so its cost can be (partially) discounted. For a rough comparison, one approach is to work with an aggregate cost metric defined as follows: # T+0.01·log n·# CNOT, where # T is the number of T gates used, 0.01 accounts for the relative efficiency of the CNOT gate relative to the T gate, n is the number of qubits in the computation, and # CNOT is the number of CNOT gates used. Here the factor of log n underestimates the typical cost of performing gates between qubits in a realistic architecture (whereas the true cost may be closer to ∛√{square root over (n)} in three dimensions or √{square root over (n)} in two dimensions). Since the approaches described herein preserve the structure of the original circuit, this metric should give a conservative comparison with other approaches (such as the T-par approach mentioned below) that may introduce long-range gates. Therefore, showing advantage with respect to this aggregate cost can very crudely demonstrate the benefits of the proposed optimization techniques described in this disclosure.

Results from using the techniques described in this disclosure can be compared directly with the results reported by Amy, Maslov, and Mosca, which aim to reduce the T count and T depth using techniques based on matroid partitioning. That approach is what is referred to in this disclosure as T-par. Results from using the techniques described in this disclosure are used to optimize a set of benchmark circuits appearing in that work and the results are compared with the T-par optimization, as shown in Tables 4A-4C (FIGS. 17A-17C).

The benchmark circuits fall into three categories. The first set (Table 4A in FIG. 17A) consists of a selection of arithmetic operations. For these circuits, better or matching T counts are obtained compared to the benchmarks while also obtaining much better CNOT counts. Note that the circuit CSLA-MUX₃ is excluded from the comparison since it is believed T-par optimized it incorrectly. To illustrate the advantage of the optimization techniques described herein, using the aggregate cost metric described above the proposed techniques reduced the cost of the RC-Adder₆ circuit from 71.91 to 49.70. The improvement in cost is thus by about 31%, mostly due to a reduced T gate count.

The second set of benchmarks consists of multiply-controlled Toffoli gates (Table 4B in FIG. 17B). While the proposed optimizer matched the T count obtained by the T-par optimizer and substantially reduced the CNOT count, neither the proposed optimizer nor the previous approaches could find the best known implementations. This is not surprising, given the very different circuit structure employed in the best known implementations.

The third set of benchmarks contains Galois field multiplier circuits (Table 4C in FIG. 17C). In an example, the Heavy optimizer is terminated when its runtime exceeds that of the light optimizer by a factor of 200. Such a timeout occurred when applying the Heavy optimizer to the four largest instances of the Galois field multiplier circuits. There was no advantage from the Heavy optimizer over the Light optimizer in the cases tested, so the Heavy optimizer was not applied to the four largest instances (the corresponding entries are left blank in Table 4C). The T count again matches that of the T-par optimizer, but the CNOT count is much lower, resulting in the circuits that are clearly preferred. For example, the optimized GF(2⁶⁴) multiplier circuit has been shown to use 180,892 CNOT gates, whereas the optimized implementation resulting from the techniques of this disclosure uses only 24,765 CNOT gates; the aggregate cost is thus reduced from 30,168.59 to 18,326.42 despite no change in the T count, that is, by about 39%. The reduction comes mostly or solely from the CNOT gates. This comparison demonstrates that the discrepancy between T count and realistic aggregate cost estimate predicted in theory is manifested in practice. The efficiency of the Light optimizer allowed the optimization of the GF(2¹³¹) and GF(2¹⁶³) multiplier quantum circuits, corresponding to instances of the elliptic curve discrete logarithm problem that remain unsolved. Given the reported T-par optimization runtimes, an instance of this size appears to be intractable for the T-par optimizer.

A new tool for T count optimization have been proposed (e.g., by Heyfron and Campbell). The approach used in this new tool relies on measurement and classical feedback, in contrast to the fully unitary circuits considered in this disclosure. Moreover, this new tool does not provide CNOT counts, making it impossible to give a direct comparison that accounts for both T and CNOT gates. Again, this new tool solely targets T count optimization, whereas the techniques of this disclosure departed from this simple costing metric. For example, an optimized QFT₄ circuit based on this new T count optimization tool implements a 4-qubit QFT transformation using 44 qubits, suggesting that the CNOT gate overhead must be large. A further significant difference is scalability: while the techniques described herein are suitable for and applied to optimize large circuits, the new T count optimization tool only treats very small circuits—for instance, the largest GF multiplier optimized by that tool is the 7-bit case, whereas the techniques described herein can tackle GF multipliers with 131 and 163 bits, corresponding to unsolved Certicom challenges. Another difference is that the techniques proposed herein use only those qubit-to-qubit interactions already available in the input circuits. This enables executing optimized circuits in the same architecture as the input circuit, which may be useful for quantum computers over restricted architectures. In contrast, the new T count optimization tool introduces new interactions. Finally, the techniques proposed herein can handle circuits with arbitrary R_(z) gates, whereas the new T count optimization tool is limited to Clifford+T circuits.

Overall Performance

Examples of numerical optimization results produced by the optimization algorithms described in this disclosure are presented in Table 1, Table 2, Tables 3A and 3B, and Tables 4A-4C. These tables contain benchmarks relevant to practical quantum computations that are beyond the reach of classical computers. In Table 1 and Table 2 these are the 1,024- and 2,048-qubit QFT and integer adders used in classically-intractable instances of Shor's factoring algorithm. In Tables 3A and 3B these include all instances with n ≳50, for which direct classical simulation of quantum dynamics is currently infeasible. In Tables 4A-4C these are Galois field multipliers over binary fields of sizes 131 and 163, which are relevant to quantum attacks on unsolved Certicom ECC Challenge problems. This illustrates that the proposed optimizer or optimization algorithms are capable of handling quantum circuits that are sufficiently large to be practically relevant.

The proposed optimizer or optimization algorithms can be applied more generally than previous work on circuit optimization. It readily accepts composite gates, such as Toffoli gates (which may have negated controls). It also handles gates with continuous parameters, a useful feature for algorithms that naturally use R_(z) gates, including Hamiltonian simulation and factoring. Many quantum information processing technologies natively support such gates, including both trapped ions and superconducting circuits, so that the proposed approach described herein may be useful for optimizing physical-level circuits.

Fault-tolerant quantum computations generally rely on a discrete gate set, such as Clifford+T, and optimal Clifford+T implementations of R_(z) gates are already known. Nevertheless, the ability to optimize circuits with continuous parameters is also valuable in the fault-tolerant setting. This is because optimizing with respect to a natural continuously-parametrized gate set before compiling into a discrete fault-tolerant set will likely result in smaller final circuits.

Finally, unlike previous approaches, the proposed optimizer of this disclosure is configured to preserve the structure of the original quantum circuit. In particular, the set of two-qubit interactions that are used by the optimized quantum circuit is a subset of those used in the original quantum circuit. This holds because neither the pre-processing step nor the optimization algorithms introduce any new two-qubit gates. By keeping the types of interactions used under control (in stark contrast to, for example, T-par, which dramatically increases the set of interactions used), the optimized implementations resulting from the proposed optimization algorithms are better suited for architectures with limited connectivity. In particular, given a layout of the original quantum circuit on hardware with limited connectivity, this property allows use the same layout for the optimized quantum circuit. Moreover, unlike other optimization tools (e.g., the new T count optimization tool described above), the proposed optimizer of this disclosure does not increase the number of the CNOT gates used. This can be of relevant practical consideration since a long-range CNOT gate can be even more expensive than a T gate, and focusing on T optimization alone may result in circuits whose cost is dominated by CNOT gates.

Referring now to a diagram 1800 in FIG. 18, illustrated is an example computer device 1810 in accordance with an implementation, where the computer device 1810 may be used to perform the various optimization algorithms described above, including the various optimization subroutines and the Light and Heavy versions of the optimizer. The computer device 1810 can represent a single computing device, multiple computing devices, or a distributed computing system, for example. The computer device 1810 may be configured to execute or perform the automated optimization of quantum circuits, including automated optimization of large-scale quantum circuits with continuous parameters, as described herein. Moreover, the computer device 1810 may be configured to receive information about the quantum circuits (e.g., a netlist) and generate new information (e.g., a new netlist) after the optimization such that the number of quantum gates needed to implement the quantum circuits (or the functionality of the quantum circuits) is less than the number of quantum gates originally needed (e.g., prior to the optimization) to implement the quantum circuits (or the functionality of the quantum circuits).

In one example, the computer device 1810 may include a processor 1848 for carrying out processing functions associated with one or more optimization functions or operations described herein. The processor 1848 can include a single or multiple set of processors or multi-core processors. Moreover, the processor 1848 can be implemented as an integrated processing system and/or a distributed processing system. In an implementation, for example, the processor 1848 may include a central processing unit (CPU), a graphics processing unit (GPU), a tensor processing unit (TPU), or a combination of one or more of these types of units, which can be configured to perform one or more of the optimization functions or operations described herein.

In an example, the computer device 1810 may include a memory 1850 for storing instructions executable by the processor 1848 for carrying out the functions described herein. In an implementation, for example, the memory 1850 may correspond to a computer-readable storage medium that stores code or instructions to perform one or more of the optimization functions or operations described herein.

Further, the computer device 1810 may include a communications component 1852 that provides for establishing and maintaining communications with one or more parties utilizing hardware, software, and services as described herein. The communications component 1852 may carry communications between components on the computer device 1810, as well as between computer device 1810 and external devices, such as devices located across a communications network and/or devices serially or locally connected to computer device 1810. In one example, the communications component 1852 may provide communication of information between the computer device 1810 and a quantum information processing (QIP) system such that optimized netlists or the like are provided to the QIP system once produced by the computer device 1810. In another example, the communications component 1852 may include one or more buses, and may further include transmit chain components and receive chain components associated with a transmitter and receiver, respectively, operable for interfacing with external devices.

Additionally, the computer device 1810 may include a data store 1854, which can be any suitable combination of hardware and/or software, that provides for mass storage of information, databases, and programs employed in connection with implementations described herein. For example, the data store 1854 may be a data repository for operating system 1840 and/or optimization application 1830. In one implementation, the data store 1854 may include memory 1850.

The data store 1854 and/or the memory 1850 may be used to store information associated with pre-optimized circuits, post-optimized circuits, intermediate information produced during optimization, the optimization algorithms, including the subroutines and various versions of the optimizer, and any of the rules associated with the optimization operations described herein.

The computer device 1810 may also include a user interface component 1856 operable to receive inputs from a user of the computer device 1810 and further operable to generate outputs for presentation to the user. The user interface component 1856 may include one or more input devices, including but not limited to a keyboard, a number pad, a mouse, a touch-sensitive display, a digitizer, a navigation key, a function key, a microphone, a voice recognition component, any other mechanism capable of receiving an input from a user, or any combination thereof. Further, the user interface component 1856 may include one or more output devices, including but not limited to a display, a speaker, a haptic feedback mechanism, a printer, any other mechanism capable of presenting an output to a user, or any combination thereof.

In an implementation, the user interface component 1856 may transmit and/or receive messages corresponding to the operation of the operating system 1840 and/or the optimization application 1830. In addition, the processor 1840 may execute the operating system 1840 and/or the optimization application 1830, and the memory 1850 or the data store 1854 may store them. Moreover, the optimization application 1830 may be executed based on stored code or instructions to perform one or more of the optimization functions or operations described herein. For example, the optimization application 1830 may select between a Light version of the optimizer or a Heavy version of the optimizer and may implement the appropriate sequence of subroutines (and any operations within each of the subroutines) accordingly.

FIG. 19 is a flow chart that illustrates a process or method 1900 to perform an automated optimization of quantum circuits in accordance with aspects of this disclosure. Aspects of the method 1900 may be performed by hardware and/or software in the computer device 1810 shown in FIG. 18.

At block 1905, the method 1900 includes receiving a netlist containing information about a first list of quantum gates that form the quantum circuits. A list of quantum gates may permit a repetition of elements since quantum circuits may have duplicates of the same quantum gates.

At block 1910, the method 1900 includes performing a phase-polynomial reduction operation on the information about the first list of quantum gates to produce a second list of quantum gates that has functional equivalence to the first list of quantum gates, a computational cost, such as a number of quantum gates, in the second list of quantum gates being smaller than a computational cost, such as a number of quantum gates, in the first list of quantum gates.

At block 1915, the method 1900 includes generating a new netlist containing information about the second list of quantum gates.

At block 1920, the method 1900 includes providing the new netlist to implement a functionality of the quantum circuits using the second list of quantum gates.

In another aspect of the method 1900, a pre-processing operation may be performed prior to performing the phase-polynomial reduction operation. The pre-processing operation may be applied to NOT gates, CNOT gates, Toffoli gates, Hadamard gates, and R_(z) gates.

In another aspect of the method 1900, a Hadamard gate reduction operation may be performed prior to performing the phase-polynomial reduction operation.

In another aspect of the method 1900, a single qubit gate cancelation operation may be performed prior to performing the phase-polynomial reduction operation.

In another aspect of the method 1900, a two-qubit gate cancelation operation may be performed prior to performing the phase-polynomial reduction operation.

In another aspect of the method 1900, performing the phase-polynomial reduction operation may include implementing a set of rewriting rules. The set of rewriting rules may include one or both of gate count preserving rewriting rules or gate count reducing rewriting rules.

In another aspect of the method 1900, one or more gate cancelation operations or gate reduction operations along with the phase-polynomial reduction operation may be performed iteratively.

In another aspect of the method 1900, a fixed sequence of optimization operations that includes the phase-polynomial reduction operation may be performed iteratively, where the phase-polynomial reduction operation is not the first optimization operation in the fixed sequence and is performed only once in the fixed sequence.

FIG. 20 shows a diagram 2000 illustrating an example of a QIP system 2005 in accordance with aspects of this disclosure. The QIP system 2005 may also be referred to as a quantum computing system, a quantum computing network, a computer device, or the like. In an aspect, the QIP system 2005 may be used to implement or perform quantum computing operations or algorithms for which the fidelity of the quantum gates being implemented depends on the ability to have a tuned, stable laser output applied to, for example, trapped ions used as quantum bits. The QIP system 2005 may correspond to a quantum computer implementation of the computer device 1810 in FIG. 18 and/or a quantum computer that receives and implements the optimized results produced by running the optimization application 1830 (e.g., the proposed optimizer or optimization algorithms) in the computer device 1810 in FIG. 18.

The QIP system 2005 represents a trapped atomic ion version of a quantum computer and can include a source 2060 that provides atomic species to a chamber 2050 having an ion trap 2070 that traps the atomic species (e.g., trapped ions) once ionized by an optical controller 2020. Optical sources 230 in the optical controller 2020 may include one or more laser sources that can be used for ionization of the atomic species, control (e.g., phase control) of the atomic ions, for fluorescence of the atomic ions that can be monitored and tracked by image processing algorithms operating in an imaging system 2040 in the optical controller 2020.

The imaging system 2040 can include a high resolution imager (e.g., CCD camera) for monitoring the atomic ions while they are being provided to the ion trap 2070 (e.g., for counting) or after they have been provided to the ion trap 2070 (e.g., for monitoring the atomic ions states). In an aspect, the imaging system 2040 can be implemented separate from the optical controller 2020, however, the use of fluorescence to detect, identify, and label atomic ions using image processing algorithms may need to be coordinated with the optical controller 2020.

The QIP system 2005 may also include an algorithms component 2010 that may operate with other parts of the QIP system 2005 (not shown) to perform quantum algorithms (e.g., QFT, quantum simulations) that make use of the optimization techniques described above. The algorithms component 2010 may provide instructions to various components of the QIP system 2005 (e.g., to the optical controller 2020) to enable the implementation of quantum circuits, or their equivalents. That is, the algorithms component 2010 may allow for mapping of different computing primitives into physical representations using, for example, the trapped ions in the ion trap 2070 as qubits.

The QIP system 2005 and/or the algorithms component 2010 can also be used to implement quantum simulations associated with chemical or molecular applications. For example, in general, the Hamiltonian of a quantum object, such as a molecule, may be represented as:

=Σ_(p,q) h _(pq) a _(p) ^(†) a _(q)+Σ_(p,q,r,s) h _(pqrs) a _(p) ^(†) a _(q) ^(†) a _(r) a _(s),

where p, q, r, and s represent integers and/or labels for electron orbitals, a_(p) ^(†) and a_(q) ^(†) are the creation operators, and a_(q), a_(r), and a_(s) are the annihilation operators. The Hamiltonian may be transformed into a form that is more amenable to quantum computing via, for example, Jordan-Wigner Transformation: a_(p) ^(†)=Î^(⊕p−1)⊕{circumflex over (σ)}+⊕{circumflex over (σ)}_(z) ^(⊕N−p) and a_(q)=Î^(⊕q−1)⊕{circumflex over (σ)}−⊕{circumflex over (σ)}_(z) ^(⊕N−q).

For small t (e.g., significantly smaller than 1), the transformation may be approximated by the Trotter splitting process, whose first order formula is

$e^{\frac{{- i}\; \Sigma_{j}^{n}{\hat{\mathcal{H}}}_{j}t}{\hslash}} \approx {e^{\frac{{- i}{\hat{\mathcal{H}}}_{1}t}{\hslash}}e^{\frac{{- i}{\hat{\mathcal{H}}}_{2}t}{\hslash}}e^{\frac{{- i}{\hat{\mathcal{H}}}_{3}t}{\hslash}}\ldots \; {e^{\frac{{- i}{\hat{\mathcal{H}}}_{n}t}{\hslash}}.}}$

If t is large, the expression becomes

$e^{\frac{{- i}\; \Sigma_{j}^{n}{\hat{\mathcal{H}}}_{j}t}{\hslash}} = {e^{\frac{{- i}\; \Sigma_{j = 1}^{n}{{\hat{\mathcal{H}}}_{j}{(\frac{t}{r})}}r}{\hslash}} = \left( e^{\frac{{- i}\; \Sigma_{j = 1}^{n}{{\hat{\mathcal{H}}}_{j}{(\frac{t}{r})}}}{\hslash}} \right)^{r}}$

such that

$e^{\frac{{- i}\; \Sigma_{j = 1}^{n}{{\hat{\mathcal{H}}}_{j}{(\frac{t}{r})}}}{\hslash}}$

inside the parentheses may be Trotterized with

$\frac{t}{r}{\operatorname{<<}1}$

for sufficiently large r. Each individual Hamiltonian

may be in the transformed form, such as the Jordan-Wigner transformed form (see above).

In some implementations, implementing the Hamiltonian of a molecule may include the use of different types of gates, such as two-qubit quantum gates. A two-qubit quantum gate, such as the two-qubit CNOT gate, may be more resource intensive than a one-qubit quantum gate, such as the Hadamard gate at the physical level of implementation. Therefore, reducing the number of two-qubit quantum gates may be important for pre-fault tolerant quantum computing.

In FIG. 21, an example of

, an effective Hamiltonian operator, that frequently arise in quantum chemistry simulations is shown. The quantum circuit that implements e^(−iΣθ) where Σ is the sum of product of Pauli matrices whose addends 2110 appear in a sequence 2100 of FIG. 21, using Trotter formulas has one or more two-qubit quantum gates. While in this example, odd numbers of σ_(x) and/or σ_(y) are considered, even numbers of such matrices in a product, e.g., that may arise from considering Hamiltonian dynamics simulations, may also be considered in what follows. Reordering the addends 2110 may allow Σ to be expressed with the addends 2110 appearing in the order shown in a sequence 2150 of FIG. 21. The first quantum circuit that implements e^(−iΣθ) with addends ordering shown in the sequence 2100 and the second quantum circuit that implements e^(−iΣθ) with addends ordering shown in the sequence 2150 may perform identical functions up to the Trotter error, but the second quantum circuit with addends shown in the sequence 2150 may utilize fewer two-qubit quantum gates by using certain reduction subroutines, examples of which are described in more detail below.

Subroutine 6. Controlled Gate Cancellation (2)

In some implementations, the addend 2110 h in the sequence 2150 may induce a quantum circuit 2200 shown in FIG. 22A.

In some implementations, the addend 2110 g in the sequence 2150 may induce a quantum circuit 2230 of FIG. 22A. FIGS. 22A-B illustrate the cancellation routine of two-qubit quantum gates according to an aspect of the present disclosure. The cancellation routine may preserve the functionalities. The first quantum circuit 2200 may include 6 CNOT gates and a single-qubit z-rotation gate, and the second quantum circuit 2230 may include 6 CNOT gates and a single-qubit z-rotation gate. Whenever the originating term includes {circumflex over (σ)}_(x) on a certain qubit, the 6 CNOT and 1 R_(Z) circuit may be conjugated by H on the qubit line. Whenever the originating term includes {circumflex over (σ)}_(Y) on a certain qubit, the 6 CNOT and 1 R_(Z) circuit may be conjugated by P^(†)H from the left and HP from the right on the qubit line. The first quantum circuit 2200 may be executed before the second quantum circuit 2230.

Still referring to FIG. 22A, in non-limiting examples, two adjacent H gates 2260 may be cancelled using the H gate cancellation operation. Similarly, two adjacent H gates 2262 may be cancelled using the H gate cancellation operation. Next, the CNOT gate 2264 may be commuted (temporarily) with a combination 2266 of a first H gate, a P gate, and a second H gate using the HPH commutation operation. The HPH commutation may switch the order of execution between the combination 2266 of the HPH gates and the CNOT gate 2264. After the commutation of the CNOT gate 2264 and the combination 2266 of HPH gates, a control qubit of the CNOT gate 2264 may be adjacent to a control qubit a CNOT gate 2268. A target qubit of the CNOT gate 2264 may be adjacent to a target qubit of the CNOT gate 2268. The CNOT gates 2264, 2268 may both be cancelled using the CNOT gate cancellation operation.

Turning to FIG. 22B, in certain examples, two-qubit quantum gates in the first quantum circuit 2200 and the second quantum circuit 2230 may be cancelled. The combination 2266 of HPH gates may be commuted with a CNOT gate 2270 using the HPH commutation operation. After the commutation of the CNOT gate 2270 and the combination 2266 of HPH gates, a control qubit of the CNOT gate 2270 may be adjacent to a control qubit a CNOT gate 2272. A target qubit of the CNOT gate 2270 may be adjacent to a target qubit of the CNOT gate 2272. The CNOT gates 2270, 2272 may both be cancelled using the CNOT gate cancellation operation.

Still referring to FIG. 22B, in some implementations, a combination of a first H gate, a P^(†) gate, and a second H gate (i.e., HP^(†)H) may be transformed into a combination of a first P gate 2274, a H gate, and a second P gate 2276 (i.e., PHP) using a HP^(†)H transformation (HP^(†)H→PHP). The first phase gate 2274 may be commuted with a CNOT gate 2278 and the second P gate 2276 may be commuted with a CNOT gate 2280 separately using the P gate commutation operation. After the two P gate commutation operations, a combination 2282 of the CNOT gate 2278, a H gate, and the CNOT gate 2280 may be replaced by a combination 2284 including three H gates, a P^(†) gate, a CNOT gate, and two P gates using the CNOT gate substitution. In certain examples, a first H gate, a P gate, and a second H gate (i.e., HPH) may be transformed into a first P^(†) gate, a H gate, and a second P^(†) gate (P^(†)HP^(†)) in a HPH transformation (HPH→P^(†)HP^(†)). In some examples, an P^(†) gate may be commuted with a CNOT gate (not shown) using the P^(†) gate commutation.

In the present non-limiting example shown in FIGS. 22A-B, 6 CNOT gates (i.e., two-qubit quantum gates) have been reduced to 1 CNOT gate (6:1 reduction ratio). Other reduction ratios may be possible, such as 5:1, 4:1, 3:1, or 2:1 for example, if different ordering is used or certain operations may not be substituted due to hardware constraints. The controlled gate cancellation subroutine may maintain the functionalities of the quantum circuits while reducing the number of two-qubit quantum gates (e.g., CNOT gates). Reduction in the number of two-qubit quantum gates may conserve resources used in implementing the quantum circuits.

In some implementations, it may be difficult or inefficient to directly implement a controlled gate, such as the CNOT gate, in hardware. As shown in FIG. 23, for example, one or more Mølmer-Sørensen (MS) gates and/or one or more single rotation gates may be used to implement the CNOT gate based on an expression 2300, where s=±1 is the sign of the interaction parameter specified by the ions of gate applies to, and v=±1 may be chosen arbitrarily. Similarly, a MS gate may be implemented by four H gates, two CNOT gates, and a single-qubit z-rotation gate based on an expression 2350.

In some examples, even when the number of two-qubit gates may remain the same or increase, if the second, equivalent circuit allows for more frequent application of small angle MS gates while reducing the number of CNOT gates (or MS gates with large angle, such as

compared to the first, original circuit, it may be desirable to implement the second circuit. For example, the second circuit may exhibit better performance in the presence of realistic noise sources including one or more of thermal noise, imprecise control, etc, in the case where small angle MS gates are less error prone to such error sources than large angle MS gates.

Other examples of implementing the operations described above may also reduce the number of two-qubit quantum gates. The subroutine 6 and the operations described above may be implemented, for example, by the computer device 1810 and/or the QIP system 2005.

FIG. 24 is a flow chart that illustrates a process or method 2400 for reducing two-qubit quantum gates in quantum circuits in accordance with aspects of this disclosure. Aspects of the method 2400 may be performed by hardware and/or software in the computer device 1810 shown in FIG. 18 and/or the QIP system 2005 in FIG. 20.

At block 2405, the method 2400 includes receiving a netlist including information relating to a first plurality of two-qubit quantum gates that form the quantum circuits. The information may include information relating to one or more of controlled gates, R_(z) gates, Hadamard gates, phase gates, or inverse phase gates. For example, the computer device 1810 may receive the netlist with include information relating to the quantum circuits configuration.

At block 2410, the method 2400 includes performing a controlled gate cancellation operation on the information relating to a first plurality of two-qubit quantum gates to produce a second plurality of two-qubit quantum gates that is functionally equivalent to the first plurality of two-qubit quantum gates, wherein a first number of two-qubit quantum gates in the first plurality of two-qubit quantum gates is larger than a second number of two-qubit quantum gates in the second plurality of two-qubit quantum gates. Examples of the controlled gate cancellation operation may include the operations associated with FIGS. 22A-B. The optimization application 1830 may execute the operations associated with FIGS. 22A-B to reduce the number of two-qubit quantum gates.

At block 2415, the method 2400 includes generating a new netlist containing information about the second plurality of two-qubit quantum gates.

At block 2420, the method 2400 includes providing the new netlist to implement a functionality of the quantum circuits based on the second plurality of two-qubit quantum gates.

In alternative implementations, the method 2400 includes performing one or more H gate cancellation operations.

In alternative implementations, the method 2400 includes performing one or more HPH commutation operations.

In alternative implementations, the method 2400 includes performing one or more CNOT gates cancellation operations.

In alternative implementations, the method 2400 includes performing one or more HP^(†)H transformations.

In alternative implementations, the method 2400 includes performing one or more P gate commutation operations.

In alternative implementations, the method 2400 includes performing one or more HPH transformations.

In alternative implementations, the method 2400 includes performing one or more P^(†) gate commutation operations.

In alternative implementations, the method 2400 includes performing one or more CNOT gate substitution.

Although the present disclosure has been provided in accordance with the implementations shown, one of ordinary skill in the art will readily recognize that there could be variations to the embodiments and those variations would be within the scope of the present disclosure. Accordingly, many modifications may be made by one of ordinary skill in the art without departing from the scope of the appended claims. 

What is claimed is:
 1. A method for reducing two-qubit gates in quantum circuits, comprising: receiving a netlist including information relating to a first plurality of two-qubit quantum gates that form the quantum circuits; performing a controlled gate cancellation operation on the information relating to a first plurality of two-qubit quantum gates to produce a second plurality of two-qubit quantum gates that is functionally equivalent to the first plurality of two-qubit quantum gates, wherein a first number of two-qubit quantum gates in the first plurality of two-qubit quantum gates is larger than a second number of two-qubit quantum gates in the second plurality of two-qubit quantum gates; generating a new netlist containing information about the second plurality of two-qubit quantum gates; and providing the new netlist to implement a functionality of the quantum circuits based on the second plurality of two-qubit quantum gates.
 2. The method of claim 1, wherein the information includes information relating to one or more of controlled gates, R_(z) gates, H gates, P gates, or P^(†) gates.
 3. The method of claim 1, wherein performing the controlled gate cancellation operation further includes performing one or more H gate cancellation operations.
 4. The method of claim 1, wherein performing the controlled gate cancellation operation further includes performing one or more HPH commutation operations.
 5. The method off claim 4, wherein performing the controlled gate cancellation operation further includes performing one or more CNOT gates cancellation operations.
 6. The method of claim 1, wherein performing the controlled gate cancellation operation further includes performing one or more HP^(†)H transformations.
 7. The method of claim 6, wherein performing the controlled gate cancellation operation further includes performing one or more P gate commutation operations.
 8. The method of claim 1, wherein performing the controlled gate cancellation operation further includes performing one or more HPH transformations.
 9. The method of claim 8, wherein performing the controlled gate cancellation operation further includes performing one or more P^(†) gate commutation operations.
 10. The method of claim 1, wherein performing the controlled gate cancellation operation further includes performing one or more CNOT gate substitution.
 11. A computer readable medium having instructions that, when executed by one or more processors, cause the one or more processors to: receive a netlist including information relating to a first plurality of two-qubit quantum gates that form the quantum circuits; perform a controlled gate cancellation operation on the information relating to a first plurality of two-qubit quantum gates to produce a second plurality of two-qubit quantum gates that is functionally equivalent to the first plurality of two-qubit quantum gates, wherein a first number of two-qubit quantum gates in the first plurality of two-qubit quantum gates is larger than a second number of two-qubit quantum gates in the second plurality of two-qubit quantum gates; generate a new netlist containing information about the second plurality of two-qubit quantum gates; and provide the new netlist to implement a functionality of the quantum circuits based on the second plurality of two-qubit quantum gates.
 12. The computer readable medium of claim 11, wherein the information includes information relating to one or more of controlled gates, R_(z) gates, H gates, P gates, or P^(†) gates.
 13. The computer readable medium of claim 11, wherein performing the controlled gate cancellation operation further includes performing one or more H gate cancellation operations.
 14. The computer readable medium of claim 11, wherein performing the controlled gate cancellation operation further includes performing one or more HPH commutation operations.
 15. The computer readable medium of claim 14, wherein performing the controlled gate cancellation operation further includes performing one or more CNOT gates cancellation operations.
 16. The computer readable medium of claim 11, wherein performing the controlled gate cancellation operation further includes performing one or more HP^(†)H transformations.
 17. The computer readable medium of claim 16, wherein performing the controlled gate cancellation operation further includes performing one or more P gate commutation operations.
 18. The computer readable medium of claim 11, wherein performing the controlled gate cancellation operation further includes performing one or more HPH transformations.
 19. The computer readable medium of claim 18, wherein performing the controlled gate cancellation operation further includes performing one or more inverse P gate commutation operations.
 20. The computer readable medium of claim 11, wherein performing the controlled gate cancellation operation further includes performing one or more CNOT gate substitutions. 